<ui:composition template="index.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:param name="pageTitle" value="Registre-se | ReviewIt" />
	<ui:param name="pageName" value="page-register" />

	<ui:define name="css"></ui:define>

	<ui:define name="feature"></ui:define>

	<ui:define name="content">
		<h:outputText value="#{userSessionBean.preRegister()}" />
		<h3>
			<div class="icon-asterisk"></div>
			Registre-se
		</h3>
		<hr />
		<p:outputPanel rendered="#{userSessionBean.userExists}">
			<div data-alert="" class="alert-box">Seja bem-vindo ao ReviewIt!</div>
		</p:outputPanel>
		<h:form id="form-new" rendered="#{not userSessionBean.userExists}" enctype="multipart/form-data" acceptcharset="ISO-8859-1">
		
			<p:messages id="msg-new" autoUpdate="true" closable="true" showDetail="false" />

			<h:outputText for="new-firstName" value="Nome*" />
			<p:inputText id="new-firstName"
				value="#{userSessionBean.user.firstName}" required="true"
				validator="validaAlfaNumerico"
				requiredMessage="Favor informar o nome!" />

			<h:outputText for="new-lastName" value="Sobrenome*" />
			<p:inputText id="new-lastName"
				value="#{userSessionBean.user.lastName}" required="true"
				validator="validaAlfaNumerico"
				requiredMessage="Favor informar o sobrenome!" />

			<h:outputText for="new-email" value="Email*" />
			<p:inputText id="new-email" value="#{userSessionBean.user.email}"
				required="true" validator="validaEmail"
				requiredMessage="Favor informar o email" />

			<h:outputText for="new-website" value="WebSite" />
			<p:inputText id="new-website" value="#{userSessionBean.user.website}" />

			<h:outputText for="new-birthdate" value="Data de Nascimento" />
			<p:calendar id="new-birthdate"
				value="#{userSessionBean.user.birthdate}" pattern="dd/MM/yyyy"
				locale="pt" />

			<h:outputText for="new-location" value="Localização" />
			<p:inputText id="new-location"
				value="#{userSessionBean.user.location}" />

			<h:outputText for="new-password" value="Senha*" />
			<p:password id="new-password"
				value="#{userSessionBean.user.password}" required="true"
				feedback="true" match="new-confirmPassword" />

			<h:outputText for="new-confirmPassword" value="Confirmar Senha*" />
			<p:password id="new-confirmPassword" value="" required="true" />

			<h:outputText for="new-foto" value="Foto" />	
			<p:fileUpload id="new-foto-file" value="#{userSessionBean.photo}" mode="simple"/>
			
			<h:outputText for="new-about" value="Sobre" />
			<p:editor id="new-about" value="#{userSessionBean.user.about}"
				controls="bold italic underline strikethrough" />
			
			<p:commandButton actionListener="#{userSessionBean.save()}"
				styleClass="button"
				oncomplete="validateForm(xhr, status, args, 'dlg-upload-doc')"
				value="Registrar" ajax="false">
			</p:commandButton>
		</h:form>
	</ui:define>

	<ui:define name="dialogs">

	</ui:define>
</ui:composition>